var now = getNowFormatDateTime(); 
var username = sessionStorage.getItem("name");
var userid = sessionStorage.getItem("userId");
var repairid=GetQueryString("repairid");
var photoUrl = [];//拍照列表
var _config ;
var dutyuser="";
$(document).ready(function(){
	$("#username").prepend(username);
	$("#repairid").append(repairid);
	getduty();
	$.ajax({
			url: '../../repair_info/getSelectBody'
			,type:'post'
			,dataType:'json'
			,contentType: "application/json; charset=utf-8"
			,data:JSON.stringify({"repairid":repairid})  
			,success: function(res){
			
				var resdata = res.data[0];
				$('#repairdate').append(resdata.repairdate);
				$('#shopcode').append(resdata.shopcode);
				$('#shopname').append(resdata.deptname);
				$('#tel').append(resdata.tel);
				$('#repairtype').append(resdata.name);
				$('#instruction').append(resdata.instruction);
				if(resdata.pic != undefined && resdata.pic != ""){
					$('#paizhapoUrl').append('<div class="wig_img">'
						+'<div class="img_box">'
						+'<img alt="100x100" src="'+resdata.pic+'" onclick="showAllPic(\''+resdata.pic+'\')"/>'
						+'</div>'
						+'</div>');
				}

					
				$('#acceptdate').append(resdata.acceptdate);
			}
	});
});
//预览图片
function showAllPic(imgOne){
	dd.biz.util.previewImage({
		urls: photoUrl,//图片地址列表
		current: imgOne,//当前显示的图片链接
		onSuccess : function(result) {
			/**/
		},
		onFail : function(err) {}
	})
}
//返回
function goback(){
	history.go(-1);
}
//提交
function getduty(){
	$.ajax({
		url: '../../repair_info/getduty'
		,type:'post'
		,dataType:'json'
		,contentType: "application/json; charset=utf-8"
		,data:JSON.stringify({"shopcode":"0000"})  
		,success: function(res){
			dutyuser = res.data[0].dutyuser;
		}
	});
}
//提交
function tijiao(){
	$.ajax({
		url: '../../repair_info/tijiao'
		,type:'post'
		,dataType:'json'
		,contentType: "application/json; charset=utf-8"
		,data:JSON.stringify({'paidanflag':'1','dutyuser':dutyuser,"repairid":repairid,"flag":22})  
		,success: function(res){
			console.log(res);
			if(res.status==1002){
				layer.msg('派单成功',{time:1000},function(){
					var url= "../../mobile_page/weixiu/weixiu_chuli";
					window.location.href = url;
				});
			}else{
				layer.msg('操作失败',{time:1000},function(){
					history.go(-1);
				});
			}
		}
	});
}